<script>
    $("#trip_type").live('change', function() {
        var selected_type = $("#trip_type:checked").val();
        if (selected_type == 'One-way') {
            $("#container_round_trip").hide("slow");
        }
        else {
            $("#container_round_trip").show("slow");
        }
    });

    $("#search_bus").live('click', function() {
        $.colorbox({
            iframe: true, 
            width: "44%", 
            height: "37%",
            href: "<?php echo base_url(); ?>index.php/rent/pre_submit/rent_bus"
        });
        
        return false;
    });
</script>
<?php 
    $attributes = array('id' => 'rent_bus');
    echo form_open(base_url()."index.php/rent/submit", $attributes); 
?>
    <input type="hidden" id="email_rent_bus" name="email" value="" />
    <input type="hidden" id="phone_rent_bus" name="phone" value="" />
    
    <h1 class="blue">Bus Transport</h1>
    <p>
        <input type="radio" id="trip_type" name="trip_type" value="One-way" checked />One-way&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="radio" id="trip_type" name="trip_type" value="Round trip" />Round trip
    </p>    
    <p>Leaving from</p>
    <p>
        <select name="location_from">
            <option value="">Please select</option>
<?php 
        foreach($location->result() as $row)
        { 
?>
            <option>
<?php 
                echo $row->province;
?>
            </option>
<?php
        }
?>      
        </select>
    </p>
    <p>Going to</p>
    <p>
        <select name="location_to">
            <option value="">Please select</option>
<?php 
        foreach($location->result() as $row)
        { 
?>
            <option>
<?php 
                echo $row->province;
?>
            </option>
<?php
        }
?>      
        </select>
    </p>    
    <p>Departure date &amp; time</p>
    <p>
        <input type="text" name="departure_date" id="departure_date" value="" class="date" style="width: 150px;" />
        <input type="text" name="departure_time" id="departure_time" value="" class="time" style="width: 90px;" />
    </p>
    <div id="container_round_trip" class="hidden">
        <p>Return date &amp; time</p>
        <p>
            <input type="text" name="return_date" id="return_date" value="" class="date" style="width: 150px;" />
            <input type="text" name="return_time" id="return_time" value="" class="time" style="width: 90px;" />
        </p>
    </div>
    <p>
        Company
    </p>
    <p>
        <select name="company">
            <option>Please select</option>
<?php 
        foreach($bus_company->result() as $row)
        { 
?>
            <option>
<?php 
                echo $row->name;
?>
            </option>
<?php
        }
?>      
        </select>
    </p>
    <p>Number of seats requested</p>
    <p>
        <input type="text" name="seat" id="seat" value="" />
    </p>
    <input type="hidden" value="Search" name="submit_rent_bus" />
    <input type="button" value="Search" class="search" id="search_bus" />
<?php  
    echo form_close();
?>